<?php
namespace App\Hospital\Models;

use App\Models\Family;
use App\Models\HospitalAppoint;
use Dcat\Admin\Admin;
use Illuminate\Database\Eloquent\Builder;

class FamilyModel extends Family{


    protected static function boot()
    {
        parent::boot();

        static::addGlobalScope('hospital_id', function (Builder $builder) {
            $builder->with(['hospital'=>function($query){
                $query->where('hospital_id', Admin::user()->hospital_id);
            }]);
        });
    }
}